package com.jackie.tongzhuang.DataBase;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DbHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "database.db";
    private static final int DATABASE_VERSION = 1;

    public DbHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        // 创建供货商表
        String create_GongHuoShang_SQL = "CREATE TABLE GongHuoShang (" +
                "Id            INTEGER    PRIMARY KEY AUTOINCREMENT," +
                "MingCheng     TEXT (100)," +
                "DiZhi         TEXT (200)," +
                "LianXiDianHua TEXT (11)," +
                "WeiXin        TEXT (11) " +
                ");";
        db.execSQL(create_GongHuoShang_SQL);
        // 创建分期表
        String create_FenQi_SQL = "CREATE TABLE FenQi (" +
                "    Id            INTEGER PRIMARY KEY AUTOINCREMENT," +
                "    JinHuoDanId   INTEGER," +
                "    QiShu         INTEGER," +
                "    YiChangHuan   INTEGER," +
                "    FenQiJinE     NUMERIC," +
                "    ChangHuanJinE NUMERIC," +
                "    BenJin        NUMERIC," +
                "    LiXi          NUMERIC," +
                "    FenQiRiQi     TEXT," +
                "    ChangHuanRiQi TEXT" +
                ");";
        db.execSQL(create_FenQi_SQL);
        // 创建进货单表
        String create_JinHuoDan_SQL = "CREATE TABLE JinHuoDan (" +
                "    Id             INTEGER PRIMARY KEY AUTOINCREMENT," +
                "    LeiBieId       NUMERIC," +
                "    GongHuoShangId INTEGER," +
                "    JinHuoRiQi     TEXT," +
                "    JinHuoJinE     NUMERIC" +
                ");";
        db.execSQL(create_JinHuoDan_SQL);
        //创建银行卡表
        String create_YinHangKa_SQL = "CREATE TABLE YinHangKa (" +
                "    Id        INTEGER PRIMARY KEY AUTOINCREMENT," +
                "    YinHang   TEXT," +
                "    MingCheng TEXT," +
                "    KaHao     TEXT," +
                "    EDu       NUMERIC," +
                "    KeYongEDu NUMERIC" +
                ");";
        db.execSQL(create_YinHangKa_SQL);


    }


    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
